﻿using System.IO;
using System.Text;
using System.Xml.Serialization;

namespace Mnk.Merger.Code.Common
{
    class Serializer : ISerializer
    {
        public T Deserialize<T>(string source)
        {
            var serializer = new XmlSerializer(typeof(T));
            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(source)))
            {
                using (var sr = new StreamReader(ms))
                {
                    return (T)serializer.Deserialize(sr);
                }
            }
        }
    }
}